type Name = string;
type NameResolver = () => string;
type NameOrResolver = Name | NameResolver;

function getName(n: NameOrResolver): Name {
    if (typeof n === 'string') {
        return n
    }
    return n()
}


type EventNames = 'click' | 'scrool' | 'mouseenter'

function handelEvent(ele: Element, event: EventNames) {
    // do something
}

handelEvent(document.getElementById('hello'), 'click')
// handelEvent(document.getElementById('hello'), 'dblclick')
